import java.util.InputMismatchException;
import java.util.Scanner;

public class demo4
{


    public static int getdate()
    {
        try(Scanner scanner=new Scanner(System.in))
        {
            int b=scanner.nextInt();
            return b;

        }catch(NullPointerException e)
        {
            e.printStackTrace();
        } finally {

        return 20;
        //System.out.println("此处代码一定执行");
        //scanner.close();
    }



    }
    public static void main7(String[] args) {
        int day=getdate();
        System.out.println(day);
    }
    public static void main6(String[] args) {
        try(Scanner a=new Scanner(System.in))
        {
         int c=a.nextInt();


        }catch(InputMismatchException e)
        {
            e.printStackTrace();
        }finally {
            System.out.println("此处代码一定执行");
        }



    }
    public static void main5(String[] args) {
        try {
            int[] arr = {1, 2, 3, 4};
            arr[4] = 8;
            System.out.println("此处的代码不执行");
        }catch(Exception e)
        {
            e.printStackTrace();
        }
        System.out.println("此处的代码执行");
    }
    public static void search()
    {
        throw new ArithmeticException();

    }
    public static void main4(String[] args) {
        try{
            search();
        }catch(NullPointerException e)
        {
            e.printStackTrace();
        }
        catch(ArithmeticException e)
        {
            e.printStackTrace();
        }
        catch(ArrayIndexOutOfBoundsException e)
        {
            e.printStackTrace();
        }
        System.out.println("执行后续代码");
    }
    public static void main3(String[] args) {

        try{
            int[]arr={3,4,5};
            arr=null;
            System.out.println(3);

        }catch(NullPointerException e)
        {
            e.printStackTrace();
        }
    }
    public static void main2(String[] args) {
        try{
            int[]arr={1,2,3};
            arr[4]=3;
            System.out.println(2);

        }catch(ArrayIndexOutOfBoundsException e)
        {
            e.printStackTrace();
        }
        System.out.println(3);
    }
    public static void main1(String[] args) {

        try{
            int b=10/0;
        }catch(ArithmeticException e)
        {
            e.printStackTrace();
        }
        System.out.println(1);

    }





}
